package com.cskaoyan.market.controller.wx;

import com.cskaoyan.market.annotation.AutoValidate;
import com.cskaoyan.market.db.domain.MarketFeedback;
import com.cskaoyan.market.service.wx.WxFeedbackService;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wutanzi
 * @Date: 2023/5/23 下午3:56
 * @Version: v1.0.0
 * @Description: 反馈信息controller层
 **/
@RestController
@RequestMapping("/wx/feedback")
public class WxFeedbackController {
    @Autowired
    WxFeedbackService userFeedbackService;

    @PostMapping("/submit")
    @AutoValidate
    public Object submit(@RequestBody @Validated MarketFeedback marketFeedback, BindingResult bindingResult) {
        int resCode = userFeedbackService.submit(marketFeedback);
        if (resCode == 1) {
            return ResponseUtil.ok();
        } else {
            return ResponseUtil.fail();
        }

    }


}
